﻿using GJB.MVVMDemo01.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GJB.MVVMDemo01.ViewModels
{
    public class DashboardViewModel
    {
        public DashboardModel dashboardModel { get; set; }

        public DashboardViewModel()
        {
            dashboardModel = new DashboardModel();

            dashboardModel.Income = 39730;
            dashboardModel.Outcome = 6300;

            // 图表数据集
            List<string> list = new List<string>() { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
            Random random = new Random();
            dashboardModel.GraphData = new System.Collections.ObjectModel.ObservableCollection<GraphItemModel>();

            list.ForEach(x =>
            {
                dashboardModel.GraphData.Add(new GraphItemModel
                {
                    Income = random.Next(20, 50),
                    Outcome = random.Next(10, 30),
                    Tag = x
                });
            });
        }
    }
}
